package org.theSeed.fileContract.contract.impl;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;
import org.theSeed.fileContract.contract.FileContract;
import org.theSeed.fileContract.pojo.prop.FileConfigProp;

/**
 * 文件合约抽象实现
 */
public abstract class FileContractAbstract implements FileContract {
    public FileContractAbstract(String contractTypeInstance, FileConfigProp fileConfigProp,Long chipFileSize) {
        this.contractTypeInstance = contractTypeInstance;
        this.fileConfigProp = fileConfigProp;
        if (ObjectUtil.isNotNull(chipFileSize)){
            this.chipFileSize = chipFileSize;
        }
    }

    private FileConfigProp fileConfigProp;

    /**
     * 具体实例名称
     */
    private String contractTypeInstance;

    /**
     * 文件分片大小
     */
    @Getter
    private Long chipFileSize = 1024 * 1024 * 2l;

    @Override
    public FileConfigProp getFileConfigProp() {
        return fileConfigProp;
    }

    @Override
    public String getContractTypeInstance() {
        return contractTypeInstance;
    }

    public FileContractAbstract(Long chipFileSize) {
        this.chipFileSize = chipFileSize;
    }
}
